package com.xiaochong.tir.trades.rabbit;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * k线时时计算5分钟-15m，30m，1h，4H，一天，一周，一月k线
 */
@Configuration
@Component
public class ExchangePairAllQueenConfig {
    @Bean
    public DirectExchange ExchangePairAllNodeAPIExchange() {
        return new DirectExchange(ExchangeQueue.Exchange.EX_NODE_API_MQ, true, false);
    }
    @Bean
    public Queue queueExchangePairAction(){
        return new Queue(ExchangePairAllMqQueue.QUEUE_K_ACTION_EXCHANGE_All, true);
    }
    @Bean
    public Binding bindingExchangePairAction(){
        return BindingBuilder.bind(queueExchangePairAction()).to(ExchangePairAllNodeAPIExchange()).with(ExchangePairAllMqQueue.QUEUE_K_ACTION_EXCHANGE_All);
    }

    @Bean
    public Queue queueExchangePairDevAction(){
        return new Queue(ExchangePairAllMqQueue.QUEUE_K_ACTION_EXCHANGE_All_DEV, true);
    }
    @Bean
    public Binding bindingExchangePairDevAction(){
        return BindingBuilder.bind(queueExchangePairDevAction()).to(ExchangePairAllNodeAPIExchange()).with(ExchangePairAllMqQueue.QUEUE_K_ACTION_EXCHANGE_All_DEV);
    }
}
